package com.zmx.doctor.adapter;

import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.doctor.R;
import com.zmx.doctor.pojo.ExpertTeam;
import com.zmx.doctor.view.activity.ExpertTeamDetailActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * 程序猿：胖胖祥
 * 时 间：2020/11/19  10:30
 * 功 能：
 */
public class ExpertTeamAdapter extends BaseAdapterRvList<ExpertTeamAdapter.ViewHolder, ExpertTeam> {


    public ExpertTeamAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, ExpertTeam expertTeam) {

        holder.name.setText(expertTeam.getName()+"("+expertTeam.getTeam_nums()+"人)");
        holder.fw_text.setText("以服务患者人数："+expertTeam.getNums()+"人");
        holder.button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent();
                intent.setClass(mActivity, ExpertTeamDetailActivity.class);
                intent.putExtra("team_id",""+expertTeam.getTeam_id());
                mActivity.startActivity(intent);

            }
        });

    }

    @NonNull
    @Override
    protected ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {

        ExpertTeamAdapter.ViewHolder holder = new ExpertTeamAdapter.ViewHolder(inflater.inflate(R.layout.adapter_expert_team, parent, false));
        return holder;
    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.fw_text)
        TextView fw_text;
        @BindView(R.id.button)
        Button button;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

    }



}
